}
}
+ /**
+ * @param string $path
+ * @param array $info
+ * @throws Exception
+ */
protected function extractCredits( $path, array $info ) {
$credits = array(
'path' => $path,
}
}
- $this->credits[$credits['name']] = $credits;
+ $name = $credits['name'];
+
+ // If someone is loading the same thing twice, throw
+ // a nice error (T121493)
+ if ( isset( $this->credits[$name] ) ) {
+ $firstPath = $this->credits[$name]['path'];
+ $secondPath = $credits['path'];
+ throw new Exception( "It was attempted to load $name twice, from $firstPath and $secondPath." );
+ }
+
+ $this->credits[$name] = $credits;
}
/**
'_prefix' => 'eg',
'Bar' => 'somevalue'
),
- ) + self::$default;
+ 'name' => 'FooBar2',
+ );
$processor->extractInfo( $this->dir, $info, 1 );
$processor->extractInfo( $this->dir, $info2, 1 );
$extracted = $processor->getExtractedInfo();
}
}
+ /**
+ * @covers ExtensionProcessor::extractCredits
+ */
+ public function testExtractCredits() {
+ $processor = new ExtensionProcessor();
+ $processor->extractInfo( $this->dir, self::$default, 1 );
+ $this->setExpectedException( 'Exception' );
+ $processor->extractInfo( $this->dir, self::$default, 1 );
+ }
+
/**
* @covers ExtensionProcessor::extractResourceLoaderModules
* @dataProvider provideExtractResourceLoaderModules